/**
 * 绘制-抽象类
 */
export default class BaseDraw {
  constructor() {
    if (this.constructor === BaseDraw) {
      throw new Error("抽象类BaseDraw不能实例化");
    }
  }
  // 抽象方法：子类必须实现
  startDraw() {
    throw new Error("抽象类BaseDraw限制: startDraw 必须被实现");
  }
  // 抽象方法：子类必须实现
  endDraw() {
    throw new Error("抽象类BaseDraw限制: endDraw 必须被实现");
  }
  // 抽象方法：子类必须实现
  removeDraw() {
    throw new Error("抽象类BaseDraw限制: removeDraw 必须被实现");
  }
  getDraw() {
    throw new Error("抽象类BaseDraw限制: getDraw 必须被实现");
  }
  // 生成uuid
  generateUUID() {
    return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(
      /[xy]/g,
      function (c) {
        const r = (Math.random() * 16) | 0,
          v = c === "x" ? r : (r & 0x3) | 0x8;
        return v.toString(16);
      }
    );
  }
}
